

#include "Account.h"
#include <stdint.h>
#include <iostream>

Account::Account( const uint32_t id, const AccountType type, const int32_t startingBalanceInCents )
  : mType      ( type )
  , mAccountId ( id )
{
  mBalance.SetBalanceFromInt (startingBalanceInCents)  ;
} 

Account::Account ( const Account & act ) { *this = act ; } 
  
Account::~Account() {} 


bool Account::WithDrawal( const double amount )
  {
    bool success = false;
    BalanceType bal;
    bal.SetBalanceFromFloat( amount );
    const double withdrawalAmt = bal;
    const double currBal = mBalance;
    if( (currBal - withdrawalAmt) >= 0 )
    {
      mBalance -= bal;
      success = true;
    }

    return( success );
  }

BalanceType & Account::Deposit( const double amount )
{
    BalanceType bal;
    bal.SetBalanceFromFloat( amount );

    mBalance += bal;

    return( mBalance );
}



